<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Gmap
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
class Gmap_View_Helper_GmapAddressLink extends Zend_View_Helper_Abstract
{

	/*
	 * @param Radcodes_Lib_Google_Map $google_map
	 * @param Gmap_Model_Gmap $gmap
	 * @param array $attribs
	 * @param array $options
	 */
	public function gmapAddressLink(Radcodes_Lib_Google_Map $google_map, Gmap_Model_Gmap $gmap, $attribs = array(), $options=array())
	{

		$onclick_js = $google_map->getOpenMarkerInfoWindowEventJs($gmap->getMapMarker(), $gmap->getMapInfoWindow());
		
		if (isset($options['text']))
		{
			$text = $options['text'];
		}
		else
		{
			$text = Engine_Api::_()->getApi('settings', 'core')->getSetting('gmap.standardizeaddress', 0) ? $gmap->formatted_address : $gmap->location;
		}
		
		$content = $this->view->htmlLink("javascript:void(0);",
		  $text,
      array_merge(array('onclick'=>$onclick_js), $attribs)
		);
		
    return $content;
	}
	

}
